In digital audio processing the samples are represented by a certain fixed-sized data type. A typical representation is 16-bit signed integers. The format limits the range of possible values of the data. In the 16 bit-example the data range is [−32768, 32767]. If the result from data manipulation, as for example a scaling, would yield a desired value outside this range, the processed data point will be truncated to the range limits. This problem is often referred to as clipping or saturation. This type of distortion is severely degrading the audio quality of the signal and it is crucial to avoid clipping and try to detect it wherever it can appear. An occurrence of as little as 0.01% clipping can be displeasing to the audio experience.
FIG. 1 illustrates an undistorted speech signal and FIG. 2 illustrates a clipped signal. The amplitude scales in FIGS. 1 and 2 are normalized. It should be noted that the clipped signal illustrated in FIG. 2 is not maxed-out at full scale, which could occur, for example, when the signal is scaled down or the processing after the clipping has higher resolution.
The type of clipping discussed above, where the clipping results in two values (one for positive sample values, and one for negative sample values, one or both may be equal to the maximum amplitude) is also referred to as “hard clipping”. In one approach, a simple detection algorithm can detect such clipping for constant sequences of the maximum and minimum sample values. Another approach, which uses a more advanced method based on the same principle, attempts to detect another clipping level in addition to the maximum and minimum values. This can occur if, for example, the signal has been scaled after being clipped.
However, in many cases there could be subsequent processing occurring (e.g., filtering where the clipped samples are dispersed). This so-called “soft clipping” can also be the result of non-linear compression in either the analog chain prior to digitization or a digital amplitude decompression. An example of soft clipping is shown in FIG. 3. Soft clipping cannot be detected with the simple algorithm of the approaches described above.